<?php

use App\Admin\Controllers\AuthUserController;
use App\Admin\Controllers\CustomerController;
use App\Admin\Controllers\DepartmentController;
use App\Admin\Controllers\DingController;
use App\Admin\Controllers\HomeController;
use App\Admin\Controllers\OptionController;
use App\Admin\Controllers\ReceptionController;
use App\Admin\Controllers\ReceptionLogController;
use App\Admin\Controllers\ReturnPerformanceController;
use App\Admin\Controllers\RoleController;
use App\Admin\Controllers\SalePerformanceController;
use App\Admin\Controllers\Statistics\SaleController;
use App\Admin\Controllers\Statistics\SalePersonalController;
use App\Admin\Controllers\UserController;
use Illuminate\Routing\Router;
use Illuminate\Support\Facades\Route;
use Dcat\Admin\Admin;

Admin::routes();

Route::group([
    'prefix' => config('admin.route.prefix'),
    'middleware' => config('admin.route.middleware'),
], function (Router $router) {

    if (config('admin.permission.enable')) {
        $router->resource('auth/roles', RoleController::class);
        $router->resource('auth/users', AuthUserController::class);
    }

    $router->get('dashboard', [HomeController::class, 'index'])->name('home');

    $router->middleware(['check-default-password'])->group(function () use ($router) {
        //应用管理
        $router->resource('ding', DingController::class);
        //用户
        $router->resource('user', UserController::class);
        //部门
        $router->resource('department', DepartmentController::class);
        $router->get('getDept', [DepartmentController::class, 'getDept']);

        //选择项管理
        $router->resource('option', OptionController::class);

        //顾问接待设置
        $router->resource('reception', ReceptionController::class);
        //接待记录
        $router->resource('reception-log', ReceptionLogController::class);

        //客户
        $router->resource('customer', CustomerController::class);

        //销售业绩
        $router->resource('sale-performance', SalePerformanceController::class);

        //复诊业绩
        $router->resource('return-performance', ReturnPerformanceController::class);

        //销售总览
        $router->get('statistics-sale', [SaleController::class, 'index']);
        //销售个人
        $router->get('statistics-sale-personal', [SalePersonalController::class, 'index']);

    });
});
